package ui;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * Play with the colors so the user could see/hide results
 * 
 * @author ido
 */
public class AnswerTableRenderer extends DefaultTableCellRenderer {

	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {

		super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
				row, column);

		setHorizontalAlignment(SwingConstants.CENTER);

		setBackground(Color.WHITE);

		if (isSelected) {
			setForeground(Color.BLACK);
			setBackground(Color.YELLOW);
		} else {
			setForeground(Color.WHITE);
		}
		return this;
	}

}
